package thread;

import org.omg.CORBA.RepositoryIdHelper;

public class Demo2 {

	public static void main(String[] args) throws InterruptedException {
		Repository<String> rep=new Repository<>(5);//存5个对象
		Thread3 t3=new Thread3(rep);
		t3.start();
		Thread.sleep(3000);//主休眠1秒
		rep.take();//等待
		System.out.println("t3==>"+ t3.getState());
		System.out.println("t3==>"+ t3.getState());
		Thread.sleep(1000);
		System.out.println("t3==>"+ t3.getState());
	}

}
class Thread3 extends Thread{
	Repository<String>rep;


	   public Thread3(Repository<String> rep) {
		super();
		this.rep = rep;
	}
@Override
public void run() {
	while(true){
		rep.save("ooo");
		System.out.println("t3-->"+getState());
	}
}

	{
		
	}
	
}